<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  

  
  <title>Hexo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="Hexo">
<meta property="og:url" content="http://yoursite.com/page/3/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:locale" content="default">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Hexo">
  
    <link rel="alternate" href="/atom.xml" title="Hexo" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
</head>
</html>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Hexo</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-Sass内置函数" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/10/25/Sass内置函数/" class="article-date">
  <time datetime="2019-10-25T01:54:01.000Z" itemprop="datePublished">2019-10-25</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/Sass/">Sass</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2019/10/25/Sass内置函数/">Sass内置函数</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<ul>
<li><p>内置函数（字符串函数，数字函数等）</p>
</li>
<li><p>自定义函数使用方法</p>
</li>
</ul>
<h2 id="数字相关函数"><a href="#数字相关函数" class="headerlink" title="数字相关函数"></a>数字相关函数</h2><table>
<thead>
<tr>
<th>函数名及参数</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>percentage($number)</td>
<td>转换成百分比</td>
</tr>
<tr>
<td>round($number)</td>
<td>执行标准舍入，即它总是将数值四舍五入为最接近的整数</td>
</tr>
<tr>
<td>ceil($number)</td>
<td>执行向上舍入，即它总是将数值向上取整</td>
</tr>
<tr>
<td>floor($number)</td>
<td>向下取整</td>
</tr>
<tr>
<td>abs($number)</td>
<td>获取绝对值</td>
</tr>
<tr>
<td>min($number…)</td>
<td>获取最小值</td>
</tr>
<tr>
<td>max($number…)</td>
<td>获取最大值</td>
</tr>
<tr>
<td>random()</td>
<td>获得随机数</td>
</tr>
</tbody></table>
<h3 id="关于-random"><a href="#关于-random" class="headerlink" title="关于 random()"></a>关于 random()</h3><p>如果没有参数传入，random 会传入一个0~1的随机数（包括小数）</p>
<p>如果传入一个整数，比如10，会获得0~10的一个随机整数</p>
<p>不能传入一个小数</p>
<h2 id="数组相关函数"><a href="#数组相关函数" class="headerlink" title="数组相关函数"></a>数组相关函数</h2><table>
<thead>
<tr>
<th>函数名及参数</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>length($list)</td>
<td>获取数组长度</td>
</tr>
<tr>
<td>nth($list, $n)</td>
<td>获取指定下标的元素。下标从1开始</td>
</tr>
<tr>
<td>set-nth($list, $n, $value)</td>
<td>替换指定下标的元素</td>
</tr>
<tr>
<td>join($list1, $list2)</td>
<td>拼接数组</td>
</tr>
<tr>
<td>append($list1, $val, <code>[$separator]</code>)</td>
<td>从数组尾部添加元素</td>
</tr>
<tr>
<td>index($list, $value)</td>
<td>返回指定元素在数组中的位置</td>
</tr>
</tbody></table>
<h2 id="字符串相关函数"><a href="#字符串相关函数" class="headerlink" title="字符串相关函数"></a>字符串相关函数</h2><table>
<thead>
<tr>
<th>函数名及参数</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>unquote($string)</td>
<td>去除引号</td>
</tr>
<tr>
<td>quote($string)</td>
<td>添加引号</td>
</tr>
<tr>
<td>str-length($string)</td>
<td>获取字符串长度</td>
</tr>
<tr>
<td>str-insert($string, $insert, $index)</td>
<td>在指定位置插入字符串</td>
</tr>
<tr>
<td>str-index($string, $substring)</td>
<td>返回指定字符在字符串的位置</td>
</tr>
<tr>
<td>to-upper-case($string)</td>
<td>转换为大写</td>
</tr>
<tr>
<td>to-lower-case($string)</td>
<td>转换为小写</td>
</tr>
</tbody></table>
<h2 id="map-相关函数"><a href="#map-相关函数" class="headerlink" title="map 相关函数"></a>map 相关函数</h2><table>
<thead>
<tr>
<th>函数名及参数</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>map-get($map, $key)</td>
<td>根据给定的 key 值，返回 map 中相关的值</td>
</tr>
<tr>
<td>map-merge($map1, $map2)</td>
<td>将两个 map 合并成一个新的 map</td>
</tr>
<tr>
<td>map-remove($map, $key)</td>
<td>从 map 中删除一个 key，返回一个新 map</td>
</tr>
<tr>
<td>map-keys($map)</td>
<td>返回 map 中所有的 key</td>
</tr>
<tr>
<td>map-value($map)</td>
<td>返回 map 中所有的 value</td>
</tr>
<tr>
<td>map-has-key($map, $key)</td>
<td>根据给定的 key 值判断 map 是否有对应的 value 值，如果有返回 true，否则返回 false</td>
</tr>
<tr>
<td>keywords($args)</td>
<td>返回一个函数的参数，这个参数可以动态的设置 key 和 value（不建议使用）</td>
</tr>
</tbody></table>
<h3 id="关于-keywords"><a href="#关于-keywords" class="headerlink" title="关于 keywords"></a>关于 keywords</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">@mixin foo($args...)&#123;</span><br><span class="line">    @debug keywords($args);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">@include foo($arg1: &apos;abc&apos;, $arg2: &apos;efg&apos;);</span><br></pre></td></tr></table></figure>

<h2 id="自定义函数"><a href="#自定义函数" class="headerlink" title="自定义函数"></a>自定义函数</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">&lt;!-- 实现rem和px的转换 --&gt;</span><br><span class="line">@function px2rem($px) &#123;</span><br><span class="line">    $rem: 37.5px;</span><br><span class="line"></span><br><span class="line">    @return ($px/$rem) + rem;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/10/25/Sass内置函数/" data-id="ck4r400rv008hl0w04gr4odde" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Sass/">Sass</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-Sass基础" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/10/23/Sass基础/" class="article-date">
  <time datetime="2019-10-23T11:25:32.000Z" itemprop="datePublished">2019-10-23</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/Sass/">Sass</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2019/10/23/Sass基础/">Sass基础</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="什么是-Sass"><a href="#什么是-Sass" class="headerlink" title="什么是 Sass"></a>什么是 Sass</h2><p>世界上最成熟、最稳定、最强大的专业级 CSS 扩展语言！</p>
<h2 id="Sass-能帮助我们解决什么问题"><a href="#Sass-能帮助我们解决什么问题" class="headerlink" title="Sass 能帮助我们解决什么问题"></a>Sass 能帮助我们解决什么问题</h2><ul>
<li><p>嵌套规则</p>
<p>  通过花括号的方式解决复杂的 CSS 父子样式嵌套问题</p>
</li>
<li><p>变量规则</p>
<p>  通过变量将公共样式抽离，减少冗余 CSS 代码</p>
</li>
<li><p>条件逻辑</p>
<p>  先高级语言一样编写逻辑性的 CSS 代码</p>
</li>
</ul>
<h1 id="Sass基础知识"><a href="#Sass基础知识" class="headerlink" title="Sass基础知识"></a>Sass基础知识</h1><h2 id="Sass-变量和引用"><a href="#Sass-变量和引用" class="headerlink" title="Sass 变量和引用"></a>Sass 变量和引用</h2><ul>
<li><p>变量格式</p>
</li>
<li><p>变量类型</p>
</li>
<li><p>变量作用域</p>
</li>
<li><p>import 规则等</p>
</li>
</ul>
<p>sass 变量中是有作用域的，基于<code>{}</code></p>
<h3 id="变量格式"><a href="#变量格式" class="headerlink" title="变量格式"></a>变量格式</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">$width: 300px;</span><br><span class="line"></span><br><span class="line">.div1 &#123;</span><br><span class="line">    width: $width;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&lt;!-- default语句 --&gt;</span><br><span class="line">&lt;!-- 添加了default语句的值都是默认值，在后面执行的语句都会被覆盖掉 --&gt;</span><br><span class="line">$width: 300px !default;</span><br><span class="line">$width: 200px;</span><br><span class="line"></span><br><span class="line">.div &#123;</span><br><span class="line">    width: $width; // 最后显示300px</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="插值语句"><a href="#插值语句" class="headerlink" title="插值语句#{}"></a>插值语句<code>#{}</code></h3><p>通过 <code>#{}</code> 插值语句可以在选择器或属性名中使用变量：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">$name: foo;</span><br><span class="line">$attr: border;</span><br><span class="line">p.#&#123;$name&#125; &#123;</span><br><span class="line">    #&#123;$attr&#125;-color: blue;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&lt;!-- 编译为 --&gt;</span><br><span class="line">p.foo &#123;</span><br><span class="line">    border-color: blue; </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="import-规则"><a href="#import-规则" class="headerlink" title="import 规则"></a>import 规则</h3><p>Sass 拓展了 <code>@import</code> 的功能，允许其导入 SCSS 或 Sass 文件。被导入的文件将合并编译到同一个 CSS 文件中，另外，被导入的文件中所包含的变量或者混合指令 (mixin) 都可以在导入的文件中使用</p>
<p>如果直接使用 <code>@import &#39;foo.css&#39;</code>的话，它会直接在原生 css 文件中编译为 <code>@import &#39;foo.css&#39;</code>，而不能起到直接将 <code>foo.css</code> 文件的 css 代码书写到原生 css 文件中，并不能起到 sass 用<code>@import</code>的根本性作用</p>
<h4 id="分音-Partials"><a href="#分音-Partials" class="headerlink" title="分音 (Partials)"></a>分音 (Partials)</h4><p>为了解决这个问题（需要导入 SCSS 或者 Sass 文件，但又不希望将其编译为 CSS），只需要在文件名前添加下划线，这样会告诉 Sass 不要编译这些文件，但导入语句中却不需要添加下划线</p>
<p>例如，将文件命名为 <code>_colors.scss</code>，便不会编译 <code>_colors.css</code> 文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">@import &quot;colors&quot;;</span><br></pre></td></tr></table></figure>

<p>上面的例子，导入的其实是 <code>_colors.scss</code> 文件</p>
<h2 id="Sass-数据类型，变量运算，mixin"><a href="#Sass-数据类型，变量运算，mixin" class="headerlink" title="Sass 数据类型，变量运算，mixin"></a>Sass 数据类型，变量运算，mixin</h2><ul>
<li><p>数字类型，颜色类型，字符串类型，数组类型，map 类型</p>
</li>
<li><p>变量的加减乘除运算等</p>
</li>
<li><p>Mixin（混合宏）用法</p>
</li>
</ul>
<h3 id="数据类型"><a href="#数据类型" class="headerlink" title="数据类型"></a>数据类型</h3><h4 id="数组类型"><a href="#数组类型" class="headerlink" title="数组类型"></a>数组类型</h4><p>示例：定义数组的方式</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">$list: (100px, 200px, &apos;string&apos;);</span><br><span class="line"></span><br><span class="line">&lt;!-- 取值 --&gt;</span><br><span class="line">&lt;!-- nth方法 --&gt;</span><br><span class="line">.div &#123;</span><br><span class="line">    width: nth($list: $list, $n: 1); // 100px</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&lt;!-- index方法 --&gt;</span><br><span class="line">.div &#123;</span><br><span class="line">    zoom: index($list: $list, $value: &apos;string&apos;); // 3</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="map-类型"><a href="#map-类型" class="headerlink" title="map 类型"></a>map 类型</h4><p>定义：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">$map: (top:1px, left:2px, bottom:3px, right:4px);</span><br><span class="line"></span><br><span class="line">.div &#123;</span><br><span class="line">    zoom: index($list: $list, $value: &apos;string&apos;); // 3</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h5 id="遍历-map-类型"><a href="#遍历-map-类型" class="headerlink" title="遍历 map 类型"></a>遍历 map 类型</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">&lt;!-- 定义map类型 --&gt;</span><br><span class="line">$map: (top:1px, left:2px, bottom:3px, right:4px);</span><br><span class="line"></span><br><span class="line">@each $key, $value in $map &#123;</span><br><span class="line">    #&#123;$key&#125;: $value;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&lt;!-- 编译后 --&gt;</span><br><span class="line">top: 1px;</span><br><span class="line">left: 2px;</span><br><span class="line">bottom: 3px;</span><br><span class="line">right: 4px;</span><br></pre></td></tr></table></figure>

<h3 id="布尔运算-Boolean-Operations"><a href="#布尔运算-Boolean-Operations" class="headerlink" title="布尔运算 (Boolean Operations)"></a>布尔运算 (Boolean Operations)</h3><p>SassScript 支持布尔型的 <code>and</code> <code>or</code> 以及 <code>not</code> 运算。</p>
<h3 id="除法运算"><a href="#除法运算" class="headerlink" title="除法运算"></a>除法运算</h3><p>以下三种情况 <code>/</code> 将被视为除法运算符号：</p>
<ul>
<li><p>如果值，或值的一部分，是变量或者函数的返回值</p>
</li>
<li><p>如果值被圆括号包裹</p>
</li>
<li><p>如果值是算数表达式的一部分</p>
</li>
</ul>
<h3 id="Mixin（混合宏）"><a href="#Mixin（混合宏）" class="headerlink" title="Mixin（混合宏）"></a>Mixin（混合宏）</h3><p>为便于书写，@mixin 可以用 = 表示，而 @include 可以用 + 表示</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">&lt;!-- 定义Mixin --&gt;</span><br><span class="line">@mixin helloMixin &#123;</span><br><span class="line">    display: inline-block;</span><br><span class="line"></span><br><span class="line">    font: &#123;</span><br><span class="line">        size: 20px;</span><br><span class="line">        weight: bold;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&lt;!-- 使用Mixin，用 @include --&gt;</span><br><span class="line">p &#123;</span><br><span class="line">    color: #fff;</span><br><span class="line">    @include helloMixin();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="参数"><a href="#参数" class="headerlink" title="参数"></a>参数</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">@mixin sexy-border($color, $width)&#123;</span><br><span class="line">    border: &#123;</span><br><span class="line">        color: $color;</span><br><span class="line">        width: $width;</span><br><span class="line">        style: dashed;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="Sass-继承和嵌套"><a href="#Sass-继承和嵌套" class="headerlink" title="Sass 继承和嵌套"></a>Sass 继承和嵌套</h2><ul>
<li><p>选择器嵌套，属性嵌套，伪类嵌套</p>
</li>
<li><p>简单继承，多继承，链式继承等</p>
</li>
</ul>
<h3 id="简单继承"><a href="#简单继承" class="headerlink" title="简单继承"></a>简单继承</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">.div1 &#123;</span><br><span class="line">    border: 1px;</span><br><span class="line">    background-color: red;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">.divext &#123;</span><br><span class="line">    @extend .div;</span><br><span class="line">    border-width: 3px;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="关联属性继承"><a href="#关联属性继承" class="headerlink" title="关联属性继承"></a>关联属性继承</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">.div1 &#123;</span><br><span class="line">    border: 1px;</span><br><span class="line">    background-color: red;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">.div1.other &#123;</span><br><span class="line">    background-image: url(&apos;hello.jepg&apos;);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&lt;!-- 如果.divext也有.other这个类，则.div1.other的属性也会被继承 --&gt;</span><br><span class="line">.divext &#123;</span><br><span class="line">    @extend .div1;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="链式继承"><a href="#链式继承" class="headerlink" title="链式继承"></a>链式继承</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">.div1 &#123;</span><br><span class="line">    border: 1px solid #000;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">.div2 &#123;</span><br><span class="line">    @extend .div1;</span><br><span class="line">    color: red;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">.div3 &#123;</span><br><span class="line">    @extend .div2;</span><br><span class="line">    color: #000;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="伪类继承"><a href="#伪类继承" class="headerlink" title="伪类继承"></a>伪类继承</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">a:hover &#123;</span><br><span class="line">    text-decoration: underline;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">.hoverlink &#123;</span><br><span class="line">    color: red;</span><br><span class="line">    @extend :hover;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="Sass-条件控制语句"><a href="#Sass-条件控制语句" class="headerlink" title="Sass 条件控制语句"></a>Sass 条件控制语句</h2><p><code>@if</code>, <code>@for</code>, <code>@while</code>, <code>@each</code>等条件控制语句</p>
<h3 id="if"><a href="#if" class="headerlink" title="@if"></a><code>@if</code></h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">@if $type == &apos;bufy&apos; &#123;</span><br><span class="line">    ...</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="for"><a href="#for" class="headerlink" title="@for"></a><code>@for</code></h3><p>through 和 to 的区别</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">@for $i form 1 through 3 &#123;</span><br><span class="line">    &lt;!-- i会增加到3 --&gt;</span><br><span class="line">    ...</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">@for $i form 1 to 3 &#123;</span><br><span class="line">    &lt;!-- i会增加到3-1 --&gt;</span><br><span class="line">    ...</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="while"><a href="#while" class="headerlink" title="@while"></a><code>@while</code></h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">$i: 6;</span><br><span class="line"></span><br><span class="line">@while $i &gt; 0 &#123;</span><br><span class="line">    ...</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="each"><a href="#each" class="headerlink" title="@each"></a><code>@each</code></h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">&lt;!-- 定义map类型 --&gt;</span><br><span class="line">$map: (top:1px, left:2px, bottom:3px, right:4px);</span><br><span class="line"></span><br><span class="line">@each $key, $value in $map &#123;</span><br><span class="line">    #&#123;$key&#125;: $value;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&lt;!-- 编译后 --&gt;</span><br><span class="line">top: 1px;</span><br><span class="line">left: 2px;</span><br><span class="line">bottom: 3px;</span><br><span class="line">right: 4px;</span><br></pre></td></tr></table></figure>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/10/23/Sass基础/" data-id="ck4r400sn00a1l0w0g7dahcmy" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Sass/">Sass</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-ES6-promise" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/10/21/ES6-promise/" class="article-date">
  <time datetime="2019-10-21T10:35:13.000Z" itemprop="datePublished">2019-10-21</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/JavaScript/">JavaScript</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2019/10/21/ES6-promise/">ES6-promise</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h1 id="什么是promise"><a href="#什么是promise" class="headerlink" title="什么是promise"></a>什么是promise</h1><p>Promise 对象用于表示一个异步操作的最终状态（完成或失败）以及其返回的值</p>
<p>Promise 对象代表了未来将要发生的事件，用来传递异步操作的消息。</p>
<h2 id="同步？异步？"><a href="#同步？异步？" class="headerlink" title="同步？异步？"></a>同步？异步？</h2><p>同步任务会阻塞程序运行</p>
<p>异步任务不会阻塞程序执行</p>
<p>示例：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">function f() &#123;</span><br><span class="line">    return new Promise(resolve =&gt; &#123;</span><br><span class="line">        setTimeout(function () &#123;</span><br><span class="line">            resolve();</span><br><span class="line">        &#125;, 1000);</span><br><span class="line">    &#125;)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">f()</span><br><span class="line">    .then(function () &#123;</span><br><span class="line">        console.log(1);</span><br><span class="line">        return f();</span><br><span class="line">    &#125;)</span><br><span class="line">    .then(function () &#123;</span><br><span class="line">        console.log(2);</span><br><span class="line">        return f();</span><br><span class="line">    &#125;)</span><br><span class="line">    .then(function () &#123;</span><br><span class="line">        console.log(3);</span><br><span class="line">    &#125;)</span><br></pre></td></tr></table></figure>

<h2 id="Promise"><a href="#Promise" class="headerlink" title="Promise"></a>Promise</h2><h3 id="信任问题"><a href="#信任问题" class="headerlink" title="信任问题"></a>信任问题</h3><ol>
<li><p>解决了回调地狱、信任问题；</p>
</li>
<li><p>promise可以有效防止回调函数控制反转的问题,一旦被确定为成功或者失败，就不能再被更改</p>
</li>
</ol>
<h3 id="Promise-then-resolve-reject"><a href="#Promise-then-resolve-reject" class="headerlink" title="Promise.then(resolve, reject)"></a>Promise.then(resolve, reject)</h3><p>resolve 和 reject 都是异步的，没办法通过 try-catch 语句捕获错误</p>
<p>示例：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">function f(a) &#123;</span><br><span class="line">    return new Promise((resolve, reject) =&gt; &#123;</span><br><span class="line">        if(a)&#123;</span><br><span class="line">            resolve(&quot;成功&quot;);</span><br><span class="line">        &#125;</span><br><span class="line">        else &#123;</span><br><span class="line">            reject(&quot;失败&quot;);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">// 此句说明，我们可以将一个表达式放进去，或者放一个数值，经过处理 再在f函数体内调用成功或错误的函数</span><br><span class="line">f(false)  </span><br><span class="line">    .then((data) =&gt; console.log(data), (data) =&gt; console.log(data));</span><br></pre></td></tr></table></figure>

<p>可以选择Promise自带的<code>.catch</code>方法捕获错误</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">function f(a) &#123;</span><br><span class="line">    return new Promise((resolve, reject) =&gt; &#123;</span><br><span class="line">        if(a)&#123;</span><br><span class="line">            resolve(&quot;成功&quot;);</span><br><span class="line">        &#125;</span><br><span class="line">        else &#123;</span><br><span class="line">            reject(&quot;失败&quot;);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">// 如果上一个执行函数未执行其中函数，catch 方法可以获取到上一个执行函数的 reject 函数，并且执行</span><br><span class="line">f(false)</span><br><span class="line">    .then((data) =&gt; console.log(data))</span><br><span class="line">    .catch(e =&gt; &#123;</span><br><span class="line">        console.log(e);</span><br><span class="line">    &#125;)</span><br></pre></td></tr></table></figure>

<h3 id="Promise-的三种状态"><a href="#Promise-的三种状态" class="headerlink" title="Promise 的三种状态"></a>Promise 的三种状态</h3><ul>
<li><p>pending：进行中</p>
</li>
<li><p>fulfilled：成功</p>
</li>
<li><p>rejected：失败</p>
</li>
</ul>
<p>状态的改变不可逆，一但决议就不能再修改</p>
<h3 id="Promise-all"><a href="#Promise-all" class="headerlink" title="Promise.all"></a>Promise.all</h3><p>该方法可以把多个 promise 实例包装成一个新的 promise 实例</p>
<p><code>Promise.all([promise1,promise2]):Promise</code> — 最终返回 Promise 实例；</p>
<ol>
<li><p>全部加载成功 则返回所有promise实例中<code>resolve()</code>回来带的参数，按数组中一一对应的顺序所集合的数组</p>
</li>
<li><p>若任意有一个失败 ，立即决议失败，但会执行成功的实例，后将失败的 promise 实例（<code>reject()</code>中参数）传递给我们</p>
</li>
<li><p>若<code>Promise.all([])</code>中，数组为空数组，则立即决议为成功执行<code>resolve()</code></p>
</li>
</ol>
<h3 id="Promise-race"><a href="#Promise-race" class="headerlink" title="Promise.race"></a>Promise.race</h3><p>只要有一个 Promise 实例被决议，则返回该实例带来的<code>resolve()</code>或<code>reject()</code>的参数</p>
<h3 id="Promise-resolve-方法，Promise-reject-方法"><a href="#Promise-resolve-方法，Promise-reject-方法" class="headerlink" title="Promise.resolve 方法，Promise.reject 方法"></a>Promise.resolve 方法，Promise.reject 方法</h3><ol>
<li><p>如果 resolve 方法中是一个值的话，则返回一个新的 Promise 对象，且它的状态为 fulfilled</p>
</li>
<li><p>如果 resolve 方法中是一个包含 then 方法的对象时（又称 thenable 对象），则返回一个新的 Promise 对象，且它的状态为 fulfilled</p>
</li>
<li><p>如果接受的是一个 Promise 实例，则返回这个 Promise 实例</p>
</li>
</ol>
<p>Promise.reject 方法类似，但就是状态为 rejected</p>
<h2 id="小技巧"><a href="#小技巧" class="headerlink" title="小技巧"></a>小技巧</h2><p>同步任务要比异步任务先执行</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/10/21/ES6-promise/" data-id="ck4r400oo002jl0w053g654in" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/">JavaScript</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-ES6扩展" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/10/18/ES6扩展/" class="article-date">
  <time datetime="2019-10-18T02:12:22.000Z" itemprop="datePublished">2019-10-18</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/JavaScript/">JavaScript</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2019/10/18/ES6扩展/">ES6扩展</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<ul>
<li><p>字符串扩展</p>
</li>
<li><p>正则扩展</p>
</li>
<li><p>数值扩展</p>
</li>
<li><p>函数扩展</p>
</li>
<li><p>对象扩展</p>
</li>
<li><p>数组扩展</p>
</li>
</ul>
<h2 id="字符串扩展"><a href="#字符串扩展" class="headerlink" title="字符串扩展"></a>字符串扩展</h2><h3 id="模版字符串"><a href="#模版字符串" class="headerlink" title="模版字符串"></a>模版字符串</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">let data=&quot;jsiasj&quot;;</span><br><span class="line">console.log(`data:$&#123;data&#125;`); // data:jsiasj</span><br></pre></td></tr></table></figure>

<h3 id="部分新的方法"><a href="#部分新的方法" class="headerlink" title="部分新的方法"></a>部分新的方法</h3><ul>
<li>padStart、padEnd</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">&lt;!-- padStart方法 --&gt;</span><br><span class="line">let str = &apos;i&apos;;</span><br><span class="line"></span><br><span class="line">let str1 = str.padStart(5, &apos;mooc&apos;);</span><br><span class="line">console.log(str1); // &apos;mooci&apos;</span><br><span class="line"></span><br><span class="line">let str1 = str.padStart(9, &apos;mooc&apos;);</span><br><span class="line">console.log(str1); // &apos;moocmooci&apos;</span><br></pre></td></tr></table></figure>

<ul>
<li>repeat</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">console.log(&apos;i&apos;.repeat(10)); // &apos;iiiiiiiiii&apos;</span><br></pre></td></tr></table></figure>

<ul>
<li>startsWith、endsWith：判断字符串是不是以…开头\结尾</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">const str = &apos;A promsie is a promsie&apos;;</span><br><span class="line"></span><br><span class="line">console.log(str.startsWith(&apos;B&apos;)); // false</span><br><span class="line">console.log(str.startsWith(&apos;A pro&apos;)); // true</span><br></pre></td></tr></table></figure>

<ul>
<li>includes</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">const str = &apos;A promise is a promise&apos;;</span><br><span class="line"></span><br><span class="line">if(str.includes(&apos;a promise&apos;))&#123;</span><br><span class="line">    console.log(&quot;存在&quot;); //存在</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="新的-Unicode-表示法和遍历方式"><a href="#新的-Unicode-表示法和遍历方式" class="headerlink" title="新的 Unicode 表示法和遍历方式"></a>新的 Unicode 表示法和遍历方式</h3><h4 id="使用-for-of-遍历字符串"><a href="#使用-for-of-遍历字符串" class="headerlink" title="使用 for-of 遍历字符串"></a>使用 for-of 遍历字符串</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">var str = &quot;promise&quot;;</span><br><span class="line"></span><br><span class="line">for (let word of str)&#123;</span><br><span class="line">    console.log(word);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="Unicode-表示法"><a href="#Unicode-表示法" class="headerlink" title="Unicode 表示法"></a>Unicode 表示法</h4><p>Unicode 是一项标准，包括字符集、编码方案等</p>
<p>它是为了解决传统的字符编码方案的局限而产生的，为每种语言中的每个字符设定了统一并且唯一的二进制编码，以满足跨语言、跨平台进行文本转换、处理的要求</p>
<p>一般的 Unicode 编码支持 0000~ffff</p>
<p>如果想要表示 “\u1f436” 这种字符串，则需要”\u{1f436}”写法</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">&lt;!-- codePointAt 获取字符串中对应的一个码点 --&gt;</span><br><span class="line">🐶.codePointAt(0); // 128054</span><br><span class="line"></span><br><span class="line">&lt;!-- 如果想要获取🐶的 Unicode 编码 --&gt;</span><br><span class="line">🐶.codePointAt(0).toString(16); // 1f436</span><br></pre></td></tr></table></figure>

<h2 id="正则扩展"><a href="#正则扩展" class="headerlink" title="正则扩展"></a>正则扩展</h2><h3 id="u-修饰符"><a href="#u-修饰符" class="headerlink" title="u 修饰符"></a>u 修饰符</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">&lt;!-- &apos;\ud83d\udc36&apos;为一个字符，但是如果像下列这样写的话，系统会将其视为两个字符，才为 true --&gt;</span><br><span class="line">console.log(/^\ud83d/.test(&apos;\ud83d\udc36&apos;)); // true</span><br><span class="line"></span><br><span class="line">&lt;!-- 添加 u 修饰符，系统会将其视为一个字符 --&gt;</span><br><span class="line">console.log(/^\ud83d/u.test(&apos;\ud83d\udc36&apos;)); // false</span><br></pre></td></tr></table></figure>

<h3 id="y-修饰符"><a href="#y-修饰符" class="headerlink" title="y 修饰符"></a>y 修饰符</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">const r1 = /imooc/g;</span><br><span class="line">const r2 = /imooc/y;</span><br><span class="line"></span><br><span class="line">const str = &apos;imoocimooc-imooc&apos;;</span><br><span class="line"></span><br><span class="line">console.log(r1.exec(str)); // &quot;imooc&quot;, index=0</span><br><span class="line">console.log(r1.exec(str)); // &quot;imooc&quot;, index=5</span><br><span class="line">console.log(r1.exec(str)); // &quot;imooc&quot;, index=11</span><br><span class="line">console.log(r1.exec(str)); // null</span><br><span class="line"></span><br><span class="line">console.log(r2.exec(str)); // &quot;imooc&quot;, index=0</span><br><span class="line">console.log(r2.exec(str)); // &quot;imooc&quot;, index=5</span><br><span class="line">console.log(r2.exec(str)); // null</span><br></pre></td></tr></table></figure>

<h2 id="数值扩展"><a href="#数值扩展" class="headerlink" title="数值扩展"></a>数值扩展</h2><h3 id="新的进制表示法"><a href="#新的进制表示法" class="headerlink" title="新的进制表示法"></a>新的进制表示法</h3><p><code>0o</code>或<code>0O</code>表示八进制</p>
<p><code>0b</code>或<code>0B</code>表示二进制</p>
<h3 id="新的方法与安全数"><a href="#新的方法与安全数" class="headerlink" title="新的方法与安全数"></a>新的方法与安全数</h3><ul>
<li><p>isFinite：是否为无限</p>
</li>
<li><p>isSafeInteger：是否处于js能精确表示的范围</p>
<p>  范围为 Number.MIN_SAFE_INTEGER ~ Number.MAX_SAFE_INTEGER</p>
</li>
<li><p>幂运算（默认右结合）</p>
  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">let a = 2 ** 10;</span><br><span class="line">console.log(a); // 1024</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h2 id="函数扩展"><a href="#函数扩展" class="headerlink" title="函数扩展"></a>函数扩展</h2><h3 id="函数参数默认值"><a href="#函数参数默认值" class="headerlink" title="函数参数默认值"></a>函数参数默认值</h3><h3 id="剩余参数"><a href="#剩余参数" class="headerlink" title="剩余参数"></a>剩余参数</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">function add(..args)&#123;</span><br><span class="line">    console.log(args); // [1, 2, 3, 4, 5]</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">add(1, 2, 3, 4, 5);</span><br></pre></td></tr></table></figure>

<h3 id="箭头函数"><a href="#箭头函数" class="headerlink" title="箭头函数"></a>箭头函数</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">const add1 = (a, b) =&gt; &#123;</span><br><span class="line">    return a + b;</span><br><span class="line">&#125;;</span><br><span class="line"></span><br><span class="line">const add2 = function(a, b)&#123;</span><br><span class="line">    return a + b;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">console.log(add1(2, 2)); // 4</span><br><span class="line">console.log(add2(2, 2)); // 4</span><br><span class="line"></span><br><span class="line">&lt;!-- 以上两种方法相同 --&gt;</span><br></pre></td></tr></table></figure>

<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">const pop = arr =&gt; void arr.pop();</span><br><span class="line">console.log(pop([1, 2, 3])); // undefined</span><br><span class="line"></span><br><span class="line">const pop = arr =&gt; arr.pop();</span><br><span class="line">console.log(pop([1, 2, 3])); // 3</span><br><span class="line"></span><br><span class="line">const pop = arr =&gt; &#123;</span><br><span class="line">    // 因为其没有 return，所以不会有返回值</span><br><span class="line">    arr.pop();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>箭头函数中并无 arguments 对象，只能用扩展运算符实现 arguments 的功能</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">const log = (...args) =&gt; &#123;</span><br><span class="line">    console.log(args);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">log(1, 2, 3); // [1, 2, 3]</span><br></pre></td></tr></table></figure>

<p>箭头函数并不像普通函数一样具有函数作用域</p>
<h2 id="对象扩展"><a href="#对象扩展" class="headerlink" title="对象扩展"></a>对象扩展</h2><h3 id="对象的简洁表示法"><a href="#对象的简洁表示法" class="headerlink" title="对象的简洁表示法"></a>对象的简洁表示法</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">const getUserInfo = (id = 1) =&gt; &#123;</span><br><span class="line">    const name = &apos;xiaoming&apos;;</span><br><span class="line">    const age = 10;</span><br><span class="line">    return &#123;</span><br><span class="line">        name, // 会自动寻找同名变量，相当于 name: name</span><br><span class="line">        age,</span><br><span class="line">        say()&#123;</span><br><span class="line">            console.log(this.name + this.age);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">const xiaoming = getUserInfo();</span><br></pre></td></tr></table></figure>

<h3 id="属性名表达式"><a href="#属性名表达式" class="headerlink" title="属性名表达式"></a>属性名表达式</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">const key = &apos;age&apos;;</span><br><span class="line">const xiaoming = &#123;</span><br><span class="line">    name: &apos;xiaoming&apos;,</span><br><span class="line">    [key]: 14 // [`$&#123;key&#125;123`]: 14</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="扩展运算符"><a href="#扩展运算符" class="headerlink" title="扩展运算符"></a>扩展运算符</h2><h3 id="复制对象——浅拷贝"><a href="#复制对象——浅拷贝" class="headerlink" title="复制对象——浅拷贝"></a>复制对象——浅拷贝</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">const obj1 = &#123;</span><br><span class="line">    a: 1,</span><br><span class="line">    b: 2,</span><br><span class="line">    d: &#123;</span><br><span class="line">        aa: 1,</span><br><span class="line">        bb: 2</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">const cObj1 = &#123;...obj1&#125;; // 浅拷贝</span><br><span class="line">console.log(cObj1.d.aa); // 1</span><br><span class="line">cObj1.d.aa = 99;</span><br><span class="line">console.log(cObj1.d.aa); // 99</span><br><span class="line">console.log(cObj1.d.aa); // 99</span><br></pre></td></tr></table></figure>

<h3 id="合并对象——浅拷贝"><a href="#合并对象——浅拷贝" class="headerlink" title="合并对象——浅拷贝"></a>合并对象——浅拷贝</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">const newObj = &#123;</span><br><span class="line">    ...obj2,</span><br><span class="line">    ...obj1</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">newObj.d.aa = 22;</span><br><span class="line">console.log(obj1.d.aa); // 22</span><br></pre></td></tr></table></figure>

<h3 id="部分新的方法和属性"><a href="#部分新的方法和属性" class="headerlink" title="部分新的方法和属性"></a>部分新的方法和属性</h3><h4 id="Object-is"><a href="#Object-is" class="headerlink" title="Object.is"></a><code>Object.is</code></h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">console.log(Object.is(+0, -0)); // false</span><br><span class="line">console.log(+0 === -0); // true</span><br><span class="line">console.log(Object.is(NaN, NaN)); // true</span><br><span class="line">console.log(NaN === NaN); // false</span><br></pre></td></tr></table></figure>

<h4 id="Object-assign-——-浅拷贝"><a href="#Object-assign-——-浅拷贝" class="headerlink" title="Object.assign —— 浅拷贝"></a><code>Object.assign</code> —— 浅拷贝</h4><p>用途为合并对象或复制对象</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">const obj = &#123;</span><br><span class="line">    a: 1,</span><br><span class="line">    b: &#123;</span><br><span class="line">        c: 2</span><br><span class="line">    &#125;</span><br><span class="line">&#125;;</span><br><span class="line"></span><br><span class="line">const newObj = Object.assign(&#123;a: 3&#125;, obj);</span><br><span class="line"></span><br><span class="line">console.log(newObj.b.c); // 2</span><br><span class="line"></span><br><span class="line">newObj.b.c = 100;</span><br><span class="line"></span><br><span class="line">console.log(obj.b.c); // 100</span><br></pre></td></tr></table></figure>

<h4 id="keys、values、entries"><a href="#keys、values、entries" class="headerlink" title="keys、values、entries"></a>keys、values、entries</h4><ul>
<li><p>keys：返回迭代对象中的索引值</p>
</li>
<li><p>values：索引值所对应的值</p>
</li>
<li><p>entries：entries() 方法返回一个数组的迭代对象，该对象包含数组的键值对 (key/value)</p>
</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">const obj = &#123;</span><br><span class="line">    a: 1,</span><br><span class="line">    b: 2,</span><br><span class="line">    c: 3,</span><br><span class="line">    d: 4</span><br><span class="line">&#125;;</span><br><span class="line"></span><br><span class="line">console.log(Object.keys(obj)); // [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;]</span><br><span class="line"></span><br><span class="line">console.log(Object.values(obj)); // [1, 2, 3, 4]</span><br><span class="line"></span><br><span class="line">console.log(Object.entries(obj));</span><br><span class="line"></span><br><span class="line">for (let [k, v] of Object.entries(obj)) &#123;</span><br><span class="line">    console.log(k, v); // a 1&lt;br&gt;b 2&lt;br&gt;c 3&lt;br&gt;d 4&lt;br&gt;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="新的方法"><a href="#新的方法" class="headerlink" title="新的方法"></a>新的方法</h3><h4 id="setPrototypeOf-obj-objProto"><a href="#setPrototypeOf-obj-objProto" class="headerlink" title="setPrototypeOf(obj, objProto)"></a>setPrototypeOf(obj, objProto)</h4><p>修改 obj 的原型对象为 objProtot</p>
<h4 id="getPrototypeOf-obj"><a href="#getPrototypeOf-obj" class="headerlink" title="getPrototypeOf(obj)"></a>getPrototypeOf(obj)</h4><p>获取 obj 的原型对象</p>
<h4 id="super"><a href="#super" class="headerlink" title="super"></a>super</h4><p>可以访问到原型对象上的属性和方法</p>
<p>对象上有函数时，必须使用对象的简洁表示法才可以</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">const obj = &#123;name: &apos;xiaoming&apos;&#125;;</span><br><span class="line"></span><br><span class="line">const cObj = &#123;</span><br><span class="line">    say() &#123;</span><br><span class="line">        console.log(`My name is $&#123;super.name&#125;`);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">Object.setPrototypeOf(cObj, obj);</span><br><span class="line"></span><br><span class="line">cObj.say(); // My name is xiaoming</span><br></pre></td></tr></table></figure>

<h2 id="数组扩展"><a href="#数组扩展" class="headerlink" title="数组扩展"></a>数组扩展</h2><h3 id="结合扩展运算符使用"><a href="#结合扩展运算符使用" class="headerlink" title="结合扩展运算符使用"></a>结合扩展运算符使用</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">const user = [&apos;小明&apos;, 14, [&apos;吃饭&apos;, &apos;打游戏&apos;], &apos;我今年大二&apos;];</span><br><span class="line"></span><br><span class="line">function say(name, age, hobby, desc) &#123;</span><br><span class="line">    console.log(`我叫$&#123;name&#125;, 我今年$&#123;age&#125;岁，我喜欢$&#123;hobby.join(&apos;和&apos;)&#125;, $&#123;desc&#125;`);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">say(...user);</span><br></pre></td></tr></table></figure>

<h3 id="合并数组与复制数组"><a href="#合并数组与复制数组" class="headerlink" title="合并数组与复制数组"></a>合并数组与复制数组</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">const arr1 = [1, 2, 3, 4];</span><br><span class="line">const arr2 = [4, 2, 2, 1];</span><br><span class="line">const arr3 = [2.2, &apos;123&apos;, false];</span><br><span class="line"></span><br><span class="line">&lt;!-- 合并数组 --&gt;</span><br><span class="line">&lt;!-- 第一种方法 --&gt;</span><br><span class="line">const cArr1 = [1, 2, 3, ...arr3];</span><br><span class="line"></span><br><span class="line">&lt;!-- 第二种方法 --&gt;</span><br><span class="line">const cArr2 = [...arr1, ...arr2, ...arr3];</span><br><span class="line"></span><br><span class="line">&lt;!-- 复制数组 --&gt;</span><br><span class="line">&lt;!-- 第一种方法 --&gt;</span><br><span class="line">const cArr3 = [...arr1];</span><br><span class="line"></span><br><span class="line">&lt;!-- 第二种方法 --&gt;</span><br><span class="line">const [...cArr4] = arr3;</span><br></pre></td></tr></table></figure>

<h3 id="新方法"><a href="#新方法" class="headerlink" title="新方法"></a>新方法</h3><h4 id="Array-from"><a href="#Array-from" class="headerlink" title="Array.from"></a>Array.from</h4><p>from()方法的作用是将一个 ArrayLike 对象或者 Iterable 对象（类数组对象）转换成一个 Array</p>
<p>类数组对象的属性名必须为数值型或字符串型的数字</p>
<p>对象中的 length 键值对表示的是最终由 from 方法转换的数组的长度</p>
<p>接收两个参数，一个是需要转换的对象，一个是回调函数</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">const obj = &#123;</span><br><span class="line">    0: 1,</span><br><span class="line">    1: &apos;dfsa&apos;,</span><br><span class="line">    2: false,</span><br><span class="line">    length: 3</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">console.log(Array.from(obj));</span><br></pre></td></tr></table></figure>

<h4 id="Array-of"><a href="#Array-of" class="headerlink" title="Array.of"></a>Array.of</h4><p>将传进去的参数转换为数组</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">console.log(Array.of(1, 2, &apos;123&apos;, false));</span><br></pre></td></tr></table></figure>

<h4 id="Array-num-fill-value-start-end"><a href="#Array-num-fill-value-start-end" class="headerlink" title="Array(num).fill(value, start end)"></a>Array(num).fill(value, start end)</h4><p>将value填充数组，填充个数为数组的长度</p>
<p>即使数组里面有值，它也会将原来有的值覆盖掉</p>
<p>接受三个参数，start为开始填充的位置，end为结束填充的位置</p>
<h4 id="Array-includes-value"><a href="#Array-includes-value" class="headerlink" title="Array.includes(value)"></a>Array.includes(value)</h4><p>判断数组中是否有value，返回布尔值</p>
<h4 id="keys、values、entries-1"><a href="#keys、values、entries-1" class="headerlink" title="keys、values、entries"></a>keys、values、entries</h4><p>这里不过多阐述，请参照上面的笔记</p>
<h4 id="find"><a href="#find" class="headerlink" title="find"></a>find</h4><p>根据条件（回调）按顺序遍历数组，当回调返回true时，就返回当前遍历到的值</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">const res = [1, 7, 6, 3].find(function(value, index, arr)&#123;</span><br><span class="line">    console.log(&apos;value&apos;, value);</span><br><span class="line">    console.log(&apos;index&apos;, index);</span><br><span class="line">    console.log(&apos;arr&apos;, arr);</span><br><span class="line"></span><br><span class="line">    return value % 2 === 0;</span><br><span class="line">&#125;);</span><br><span class="line"></span><br><span class="line">console.log(res);</span><br></pre></td></tr></table></figure>

<h4 id="findIndex"><a href="#findIndex" class="headerlink" title="findIndex"></a>findIndex</h4><p>根据条件（回调）按顺序遍历数组，当回调返回true时，就返回当前遍历到的下标</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/10/18/ES6扩展/" data-id="ck4r400si009ul0w021edanl5" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/">JavaScript</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-ES6解构赋值" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/10/17/ES6解构赋值/" class="article-date">
  <time datetime="2019-10-17T10:59:34.000Z" itemprop="datePublished">2019-10-17</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/JavaScript/">JavaScript</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2019/10/17/ES6解构赋值/">ES6解构赋值</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="解构赋值"><a href="#解构赋值" class="headerlink" title="解构赋值"></a>解构赋值</h2><p>解构赋值语法是一个 JavaScript 表达式，这使得可以将值从数组或属性从对象提取到不同的变量中</p>
<ul>
<li><p>数组的结构赋值</p>
</li>
<li><p>对象的解构赋值</p>
</li>
<li><p>字符串的解构赋值</p>
</li>
<li><p>数值与布尔值的解构赋值</p>
</li>
<li><p>函数参数的解构赋值</p>
</li>
</ul>
<h3 id="数组的解构赋值"><a href="#数组的解构赋值" class="headerlink" title="数组的解构赋值"></a>数组的解构赋值</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">const arr = [1, 2, 3, 4];</span><br><span class="line">let [a, b, c, d] = arr; // a=1, b=2, b=3, b=4</span><br></pre></td></tr></table></figure>

<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">const arr = [&apos;a&apos;, &apos;b&apos;, [&apos;c&apos;, &apos;d&apos;, [&apos;e&apos;, &apos;f&apos;, &apos;g&apos;]]];</span><br><span class="line">const [a, b] = arr; // a=&apos;a&apos;, b=&apos;b&apos;</span><br><span class="line">const [, , g] = [&apos;e&apos;, &apos;f&apos;, &apos;g&apos;] // g=&apos;g&apos;</span><br><span class="line">const [, , [, , g]] = [&apos;c&apos;, &apos;d&apos;, [&apos;e&apos;, &apos;f&apos;, &apos;g&apos;]]; // g=&apos;g&apos;</span><br></pre></td></tr></table></figure>

<h4 id="扩展运算符"><a href="#扩展运算符" class="headerlink" title="扩展运算符"></a>扩展运算符</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">const arr1 = [1, 2, 3];</span><br><span class="line">const arr2 = [&apos;a&apos;, &apos;b&apos;];</span><br><span class="line">const arr3 = [&apos;zz&apos;, 1];</span><br><span class="line">const arr4 = [...arr1, ...arr2, ...arr3]; // arr4 = [1, 2, 3, &apos;a&apos;, &apos;b&apos;, &apos;zz&apos;, 1]</span><br><span class="line"></span><br><span class="line">const arr = [1, 2, 3, 4];</span><br><span class="line">const [a, b, ...c] = arr; // c = [3, 4]</span><br></pre></td></tr></table></figure>

<h4 id="默认值"><a href="#默认值" class="headerlink" title="默认值"></a>默认值</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">const arr = [1, undefined, undefined];</span><br><span class="line">const [a, b = 2, c, d] = arr; // a=1, b=2, c=d=undefined</span><br></pre></td></tr></table></figure>

<h4 id="交换变量"><a href="#交换变量" class="headerlink" title="交换变量"></a>交换变量</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[a, b] = [b, a];</span><br></pre></td></tr></table></figure>

<h3 id="对象的解构赋值"><a href="#对象的解构赋值" class="headerlink" title="对象的解构赋值"></a>对象的解构赋值</h3><p>对象的解构赋值与数组的解构赋值相似</p>
<p>等号左右两边都为对象结构 —— <code>const{a, b} = {a:1, b:2}</code></p>
<p>左边的<code>{}</code>中为需要赋值的变量</p>
<p>右边为需要解构的对象</p>
<h4 id="对象的解构赋值的主要用途"><a href="#对象的解构赋值的主要用途" class="headerlink" title="对象的解构赋值的主要用途"></a>对象的解构赋值的主要用途</h4><ul>
<li><p>提取对象属性</p>
</li>
<li><p>使用对象传入乱序的函数参数</p>
</li>
<li><p>获取多个函数返回值</p>
</li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/10/17/ES6解构赋值/" data-id="ck4r400ow002ul0w08y8oikj6" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/">JavaScript</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-bootstrap组件" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/10/16/bootstrap组件/" class="article-date">
  <time datetime="2019-10-16T08:22:17.000Z" itemprop="datePublished">2019-10-16</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/bootstrap/">bootstrap</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2019/10/16/bootstrap组件/">bootstrap组件</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="响应式页面开发"><a href="#响应式页面开发" class="headerlink" title="响应式页面开发"></a>响应式页面开发</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">@media screen and (min-width: *px) and (max-width)&#123;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="栅格布局"><a href="#栅格布局" class="headerlink" title="栅格布局"></a>栅格布局</h2><p>将屏幕分成12格</p>
<ul>
<li><p>元素所占屏幕大小：<code>col-屏幕型号-num</code></p>
</li>
<li><p>元素距左侧几格：<code>col-屏幕型号-offset-num</code></p>
</li>
</ul>
<h2 id="网页开发中的单位"><a href="#网页开发中的单位" class="headerlink" title="网页开发中的单位"></a>网页开发中的单位</h2><p>px：相对于屏幕分辨率的长度单位</p>
<p>em：相对于当前文本内的字体尺寸</p>
<p>rem 与 em 相似，相对于 HTML 根节点的字体单位</p>
<h3 id="px"><a href="#px" class="headerlink" title="px"></a>px</h3><p>px 是相对于屏幕分辨率的单位</p>
<p>px 的大小无法跟随屏幕放大缩小</p>
<h3 id="em"><a href="#em" class="headerlink" title="em"></a>em</h3><p>1em = 16px（但不完全是）</p>
<p>em 会继承父级元素的字体大小，适合手机端、平板开发</p>
<p>IE 的部分版本不支持 em</p>
<h3 id="rem"><a href="#rem" class="headerlink" title="rem"></a>rem</h3><p>rem 与 em 类似</p>
<p>rem 会继承根元素的字体大小</p>
<h2 id="bootstrap-组件"><a href="#bootstrap-组件" class="headerlink" title="bootstrap 组件"></a>bootstrap 组件</h2><ol>
<li><p>role：标识普通标签，使之语义化，方便浏览器对其具体的功能进行识别</p>
</li>
<li><p>aria-label：当焦点落到输入框时，读屏软件就会读出输入框内容</p>
</li>
<li><p>tabIndex：可以设置键盘上的 tab 键在控件中进行移动</p>
</li>
<li><p>通过该自定义属性管理交互、效果</p>
</li>
</ol>
<h3 id="字体图标"><a href="#字体图标" class="headerlink" title="字体图标"></a>字体图标</h3><ol>
<li><p>glyphicon</p>
</li>
<li><p>glyphicon-具体图标</p>
</li>
</ol>
<h3 id="下拉菜单"><a href="#下拉菜单" class="headerlink" title="下拉菜单"></a>下拉菜单</h3><ol>
<li><p>.dropdown 控制组件为下拉</p>
</li>
<li><p>.dropdown-menu-right 代替 .pull-right 右对齐</p>
</li>
<li><p>.divider 分割线</p>
</li>
</ol>
<h3 id="控件组"><a href="#控件组" class="headerlink" title="控件组"></a>控件组</h3><ol>
<li><p>.input-group 表示控件组</p>
</li>
<li><p>.input-group-addon 可放置额外内容和图标</p>
</li>
</ol>
<h3 id="导航"><a href="#导航" class="headerlink" title="导航"></a>导航</h3><ol>
<li><p>以一个带有 class .nav 的无序列表开始</p>
</li>
<li><p>.nav-tabs 代表可切换的导航</p>
</li>
<li><p>.nav-pills 代表胶囊导航</p>
</li>
<li><p>.nav-justified 使导航垂直</p>
</li>
</ol>
<h3 id="分页"><a href="#分页" class="headerlink" title="分页"></a>分页</h3><ol>
<li><p>.pagination 在父元素中添加表示分页</p>
</li>
<li><p>.pager 放置在翻页区域</p>
</li>
<li><p>.previous 把链接向左对齐，.next 把链接向右对齐</p>
</li>
</ol>
<h3 id="进度条"><a href="#进度条" class="headerlink" title="进度条"></a>进度条</h3><ol>
<li><p>.progress 表示进度条</p>
</li>
<li><p>通过状态类改变进度条的颜色</p>
</li>
<li><p>.progress-bar-striped 使得进度条颜色渐变</p>
</li>
</ol>
<h3 id="列表"><a href="#列表" class="headerlink" title="列表"></a>列表</h3><ol>
<li><p>.list-group 代表列表组</p>
</li>
<li><p>.badge 代表状态数</p>
</li>
<li><p>.active 代表选中状态</p>
</li>
</ol>
<h3 id="面板"><a href="#面板" class="headerlink" title="面板"></a>面板</h3><ol>
<li><p>.panel 代表面板</p>
</li>
<li><p>.panel-body 代表面板内容</p>
</li>
<li><p>.panel-footer 代表面板的注脚</p>
</li>
</ol>
<h2 id="Bootstrap-中的插件"><a href="#Bootstrap-中的插件" class="headerlink" title="Bootstrap 中的插件"></a>Bootstrap 中的插件</h2><ol>
<li><p>Bootstrap 插件依赖 Bootstrap.js</p>
</li>
<li><p>Bootstrap.js 基于 JQuery</p>
</li>
</ol>
<h3 id="data-属性"><a href="#data-属性" class="headerlink" title="data 属性"></a>data 属性</h3><ol>
<li><p>通过 data 属性控制页面交互</p>
</li>
<li><p>$(document).off(‘.data-api’) 解除属性绑定</p>
</li>
</ol>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/10/16/bootstrap组件/" data-id="ck4r400sq00a7l0w0onsy3xn8" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/bootstrap/">bootstrap</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-ES6基础入门let、const" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/10/13/ES6基础入门let、const/" class="article-date">
  <time datetime="2019-10-13T14:40:48.000Z" itemprop="datePublished">2019-10-13</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/JavaScript/">JavaScript</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2019/10/13/ES6基础入门let、const/">ES6基础入门let、const</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="变量声明"><a href="#变量声明" class="headerlink" title="变量声明"></a>变量声明</h2><ul>
<li><p>var</p>
</li>
<li><p>直接使用</p>
</li>
</ul>
<h2 id="let-和-var-的主要区别"><a href="#let-和-var-的主要区别" class="headerlink" title="let 和 var 的主要区别"></a>let 和 var 的主要区别</h2><ul>
<li><p>let 声明的变量只在当前（块级）作用域内有效</p>
</li>
<li><p>let 声明的变量不能重复被声明</p>
</li>
<li><p>不提供变量提升</p>
</li>
<li><p>暂存死区</p>
</li>
</ul>
<h2 id="ES6-之前的作用域"><a href="#ES6-之前的作用域" class="headerlink" title="ES6 之前的作用域"></a>ES6 之前的作用域</h2><ul>
<li><p>全局作用域</p>
</li>
<li><p>函数作用域</p>
</li>
<li><p>eval 作用域</p>
</li>
</ul>
<h2 id="const"><a href="#const" class="headerlink" title="const"></a>const</h2><p>常量：不可改变的量</p>
<h3 id="使用-const"><a href="#使用-const" class="headerlink" title="使用 const"></a>使用 const</h3><ul>
<li><p>和声明变量一样，基本只是关键字的区别</p>
</li>
<li><p>常量必须在声明的时候赋值</p>
</li>
<li><p>使用引用类型的对象时，内部的值可以被修改，可通过 Object.freeze(obj)冻结，使其内部的值不能被修改</p>
</li>
</ul>
<h3 id="与let类似的特性"><a href="#与let类似的特性" class="headerlink" title="与let类似的特性"></a>与let类似的特性</h3><ul>
<li><p>不能重复声明</p>
</li>
<li><p>不存在提升</p>
</li>
<li><p>只在当前（块级）作用域内有效</p>
</li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/10/13/ES6基础入门let、const/" data-id="ck4r400ou002pl0w0dzidqjqu" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/">JavaScript</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-HTML5音视频" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/10/13/HTML5音视频/" class="article-date">
  <time datetime="2019-10-13T01:44:00.000Z" itemprop="datePublished">2019-10-13</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/HTML5/">HTML5</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2019/10/13/HTML5音视频/">HTML5音视频</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="认识-video"><a href="#认识-video" class="headerlink" title="认识 video"></a>认识 video</h2><ul>
<li><p>video 标签定义视频，比如电影等</p>
</li>
<li><p>支持的视频格式：mp4、webm、ogv</p>
</li>
</ul>
<h3 id="video-的兼容性"><a href="#video-的兼容性" class="headerlink" title="video 的兼容性"></a>video 的兼容性</h3><ul>
<li><p>Google、Firefox 和 Opera 三种格式全部支持</p>
</li>
<li><p>Safari 浏览器不支持 video 的 webm 和 ogv 视频格式</p>
</li>
<li><p>IE8 以下均不支持 video 标签</p>
</li>
</ul>
<p>source 标签也可以放入 src，如果播放失败，video 会继续看下一个 source 标签，直到兼容</p>
<h2 id="video-属性"><a href="#video-属性" class="headerlink" title="video 属性"></a>video 属性</h2><table>
<thead>
<tr>
<th>属性</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>src</td>
<td>视频的资源地址</td>
</tr>
<tr>
<td>width</td>
<td>视频宽度</td>
</tr>
<tr>
<td>height</td>
<td>视频高度</td>
</tr>
<tr>
<td>controls</td>
<td>播放控件</td>
</tr>
<tr>
<td>autoplay</td>
<td>自动播放</td>
</tr>
<tr>
<td>loop</td>
<td>循环播放</td>
</tr>
<tr>
<td>poster</td>
<td>视频封面，没有播放时显示的图片</td>
</tr>
<tr>
<td>muted</td>
<td>当设置该属性后，它规定视频的音频输出应该被静音</td>
</tr>
</tbody></table>
<p>注意：autoplay 在Chrome上不会自动播放</p>
<h2 id="video-API-事件"><a href="#video-API-事件" class="headerlink" title="video API 事件"></a>video API 事件</h2><table>
<thead>
<tr>
<th>事件</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td>play</td>
<td>让视频播放/不在暂停时</td>
</tr>
<tr>
<td>pause</td>
<td>让视频暂停/不在播放时</td>
</tr>
<tr>
<td>duration</td>
<td>返回当前视频长度</td>
</tr>
<tr>
<td>currentTime</td>
<td>设置或返回当前视频的总长度，秒为单位</td>
</tr>
<tr>
<td>src</td>
<td>设置/返回当前视频的来源</td>
</tr>
<tr>
<td>volume</td>
<td>设置/返回当前视频的音量</td>
</tr>
<tr>
<td>controls</td>
<td>设置视频是否显示控件</td>
</tr>
<tr>
<td>muted</td>
<td>设置视频是否静音</td>
</tr>
<tr>
<td>networkState</td>
<td>返回视频的当前网络状态</td>
</tr>
<tr>
<td>currentSrc</td>
<td>返回当前音视频的URL，必须是视频加载完成时</td>
</tr>
<tr>
<td>ended</td>
<td>返回音视频的播放是否已结束</td>
</tr>
<tr>
<td>loop</td>
<td>设置或返回视频是否应在结束时重新播放</td>
</tr>
<tr>
<td>playbackRate</td>
<td>设置或返回视频播放的速度</td>
</tr>
<tr>
<td>readyState</td>
<td>属性返回视频的当前就绪状态</td>
</tr>
<tr>
<td>timeupdate</td>
<td>目前的播放位置已更改时</td>
</tr>
<tr>
<td>seeked</td>
<td>当用户已移动/跳跃到视频时的新位置时</td>
</tr>
<tr>
<td>seeking</td>
<td>当用户开始移动/跳跃到视频中的新位置时</td>
</tr>
<tr>
<td>volumechange</td>
<td>当音量已更改时</td>
</tr>
</tbody></table>
<h3 id="networkState-属性值"><a href="#networkState-属性值" class="headerlink" title="networkState 属性值"></a>networkState 属性值</h3><table>
<thead>
<tr>
<th>属性值</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td>0</td>
<td>NETWORK_EMPTY - 音频/视频尚未初始化</td>
</tr>
<tr>
<td>1</td>
<td>NETWORK_IDLE - 音频/视频是活动的且已选取资源，但并未使用网络</td>
</tr>
<tr>
<td>2</td>
<td>NETWORK_LOADING - 浏览器正在下载数据</td>
</tr>
<tr>
<td>3</td>
<td>NETWORK_NO_SOURCE - 未找到音频/视频来源</td>
</tr>
</tbody></table>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/10/13/HTML5音视频/" data-id="ck4r400pf003ql0w0pi5g38qu" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/HTML5/">HTML5</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-React简介" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/10/12/React简介/" class="article-date">
  <time datetime="2019-10-12T04:47:36.000Z" itemprop="datePublished">2019-10-12</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/React/">React</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2019/10/12/React简介/">React简介</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="什么是-React？"><a href="#什么是-React？" class="headerlink" title="什么是 React？"></a>什么是 React？</h2><ul>
<li><p>React 是一个用于构建用户界面的 JAVASCRIPT 库。</p>
</li>
<li><p>React 主要用于构建UI，很多人认为 React 是 MVC 中的 V（视图）。</p>
</li>
<li><p>React 起源于 Facebook 的内部项目，用来架设 Instagram 的网站，并于 2013 年 5 月开源。</p>
</li>
</ul>
<h2 id="React-的特点"><a href="#React-的特点" class="headerlink" title="React 的特点"></a>React 的特点</h2><ul>
<li><p>声名式开发</p>
</li>
<li><p>可以与其他框架并存</p>
</li>
<li><p>组件化</p>
</li>
<li><p>单向数据流（父组件可以直接改变子组件的数据，但子组件不能直接修改父组件的数据）</p>
</li>
<li><p>使用函数式编程</p>
</li>
</ul>
<h3 id="清楚两个概念"><a href="#清楚两个概念" class="headerlink" title="清楚两个概念"></a>清楚两个概念</h3><ul>
<li><p>library（库）：小而巧的库；优点是可以很方便的从一个库切换到另外的库，但是代码几乎不会改变</p>
</li>
<li><p>Framework（框架）：大而全的是框架；框架提供了一整套的解决方案（所以，在开发过程中想切换到另外的库，比较困难）</p>
</li>
</ul>
<h2 id="前端三大主流框架"><a href="#前端三大主流框架" class="headerlink" title="前端三大主流框架"></a>前端三大主流框架</h2><ul>
<li><p>Angular：出来较早的前端框架，学习曲线比较陡，NG1学起来比较麻烦，NG2 ~ NG5 开始，进行了一系列的改革，也提供了组件化开发的概念；从 NG2 开始，也支持使用 TS（TypeScript）进行编程</p>
</li>
<li><p>vue：最火的一门前端框架</p>
</li>
<li><p>React：最流行的一门框架，因为它的设计很优秀</p>
</li>
</ul>
<h1 id="什么是JSX语法"><a href="#什么是JSX语法" class="headerlink" title="什么是JSX语法"></a>什么是JSX语法</h1><p>JSX 语法里面，有两种类型的标签</p>
<ul>
<li><p>普通的 HTML 标签</p>
</li>
<li><p>组件标签</p>
</li>
</ul>
<h1 id="组件"><a href="#组件" class="headerlink" title="组件"></a>组件</h1><p>组件，从概念上类似于 JavaScript 函数。它接受任意的入参（即 “props”），并返回用于描述页面展示内容的 React 元素</p>
<p>所有 React 组件都必须像纯函数一样保护它们的 props 不被更改</p>
<h2 id="在react中创建组件的形式有三种"><a href="#在react中创建组件的形式有三种" class="headerlink" title="在react中创建组件的形式有三种"></a>在react中创建组件的形式有三种</h2><ul>
<li><p>纯函数式定义的无状态组件（函数组件）</p>
</li>
<li><p>React.createClass 定义的组件</p>
</li>
<li><p>Extends React.Component 定义的组件（类组件）</p>
</li>
</ul>
<h3 id="Extends-React-Component-定义的组件"><a href="#Extends-React-Component-定义的组件" class="headerlink" title="Extends React.Component 定义的组件"></a>Extends React.Component 定义的组件</h3><p>React.Component是以ES6的形式来创建react的组件的，是React目前极为推荐的创建有状态组件的方式，最终会取代React.createClass形式</p>
<h3 id="纯函数式定义的无状态组件"><a href="#纯函数式定义的无状态组件" class="headerlink" title="纯函数式定义的无状态组件"></a>纯函数式定义的无状态组件</h3><p>纯函数组件的特点:</p>
<ul>
<li><p>组件不会被实例化,整体渲染性能得到提升</p>
</li>
<li><p>组件不能访问this对象</p>
</li>
<li><p>组件无法访问生命周期的方法</p>
</li>
<li><p>无状态组件只能访问输入的props,无副作用</p>
</li>
</ul>
<p>注意：因为 return 只能返回一个根节点，所以如果出现多个根节点，可以用<code>&lt;Fragemnt&gt;&lt;/Fragment&gt;</code>标签包裹</p>
<h2 id="生命周期函数"><a href="#生命周期函数" class="headerlink" title="生命周期函数"></a>生命周期函数</h2><p>生命周期函数指的是组件在某一时刻会自动执行的函数</p>
<ul>
<li><p>constructor</p>
</li>
<li><p>componentWillMount（挂载前自动执行）</p>
</li>
<li><p>render（渲染时自动执行）（组件更新前 shouldComponentUpdate 之后会自动执行）</p>
</li>
<li><p>componentDidMount（挂载后自动执行）</p>
</li>
<li><p>shouldComponentUpdate（更新前自动执行）</p>
</li>
<li><p>componentWillUpdate（组件将要更新，之后执行 render）</p>
</li>
<li><p>componentDidUpdate（组件已经更新）</p>
</li>
<li><p>componentWillUnmount（组件从页面中移除前自动执行）</p>
</li>
</ul>
<p><a href="https://www.jianshu.com/p/c78534fd1fba" target="_blank" rel="noopener">详情请见此链接</a></p>
<p><img src="https://upload-images.jianshu.io/upload_images/14110538-96ed1615a0e16a39.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1175/format/webp" alt="生命周期函数图解"></p>
<h2 id="相关-js-库"><a href="#相关-js-库" class="headerlink" title="相关 js 库"></a>相关 js 库</h2><p>react.js：React 的核心库</p>
<p>react-dom.js：提供操作 DOM 的 react 扩展库</p>
<p>babel.min.js：解析 JSX 语法代码转为纯 JS 语法代码的库</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/10/12/React简介/" data-id="ck4r400rr0089l0w0oe4js388" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/React/">React</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-bootstrap入门之全局样式" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/10/07/bootstrap入门之全局样式/" class="article-date">
  <time datetime="2019-10-07T02:48:20.000Z" itemprop="datePublished">2019-10-07</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/bootstrap/">bootstrap</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2019/10/07/bootstrap入门之全局样式/">bootstrap入门之全局样式</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="什么是-bootstrap"><a href="#什么是-bootstrap" class="headerlink" title="什么是 bootstrap"></a>什么是 bootstrap</h2><ul>
<li><p>bootstrap 是 Twitter 公司开发基于 HTML、CSS、JavaScript 的前端框架</p>
</li>
<li><p>为实现 web 应用程序快速开发提供的一套前端工具包</p>
</li>
<li><p>响应式布局</p>
</li>
<li><p>移动设备优先</p>
</li>
</ul>
<h2 id="bootstrap-的特性"><a href="#bootstrap-的特性" class="headerlink" title="bootstrap 的特性"></a>bootstrap 的特性</h2><ul>
<li><p>响应式设计</p>
</li>
<li><p>栅格布局</p>
</li>
<li><p>完整的类库</p>
</li>
<li><p>jQuery 插件</p>
</li>
</ul>
<h2 id="bootstrap-全局样式的特点"><a href="#bootstrap-全局样式的特点" class="headerlink" title="bootstrap 全局样式的特点"></a>bootstrap 全局样式的特点</h2><ul>
<li><p>代码整洁</p>
</li>
<li><p>风格统一</p>
</li>
<li><p>美观易用</p>
</li>
</ul>
<p>bootstrap 提供了大量的全局样式，基本的 HTML 元素均可以通过 class 设置样式并得到增强效果</p>
<h2 id="bootstrap-中的排版"><a href="#bootstrap-中的排版" class="headerlink" title="bootstrap 中的排版"></a>bootstrap 中的排版</h2><p>bootstrap 对默认的排版方式进行了 CSS 样式定义，使得各种基本结构套用出来的 HTML 页面更加美观</p>
<h3 id="标题"><a href="#标题" class="headerlink" title="标题"></a>标题</h3><ul>
<li><p>标题（h1 ~ h6 / .h1 ~ .h6）</p>
<table>
<thead>
<tr>
<th>标题</th>
<th>字体大小</th>
</tr>
</thead>
<tbody><tr>
<td>h1</td>
<td>36px</td>
</tr>
<tr>
<td>h2</td>
<td>30px</td>
</tr>
<tr>
<td>h3</td>
<td>24px</td>
</tr>
<tr>
<td>h4</td>
<td>18px</td>
</tr>
<tr>
<td>h5</td>
<td>14px</td>
</tr>
<tr>
<td>h6</td>
<td>12px</td>
</tr>
</tbody></table>
</li>
<li><p>副标题（small）</p>
</li>
</ul>
<h3 id="文本"><a href="#文本" class="headerlink" title="文本"></a>文本</h3><ul>
<li>段落</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">p 标签</span><br><span class="line"></span><br><span class="line">默认：14px</span><br><span class="line">行高：20px</span><br><span class="line">底部外边距：10px</span><br></pre></td></tr></table></figure>

<ul>
<li>强调</li>
</ul>
<blockquote>
<p><code>&lt;mark&gt;&lt;/mark&gt;</code></p>
</blockquote>
<ul>
<li>删除</li>
</ul>
<blockquote>
<p><code>&lt;del&gt;&lt;/del&gt;</code></p>
</blockquote>
<ul>
<li>下划线</li>
</ul>
<blockquote>
<p><code>&lt;ins&gt;&lt;/ins&gt;</code></p>
</blockquote>
<ul>
<li>文本标记</li>
</ul>
<h3 id="对齐"><a href="#对齐" class="headerlink" title="对齐"></a>对齐</h3><ul>
<li><p><code>.text-left</code></p>
</li>
<li><p><code>.text-center</code></p>
</li>
<li><p><code>.text-right</code></p>
</li>
</ul>
<h3 id="大小写"><a href="#大小写" class="headerlink" title="大小写"></a>大小写</h3><ul>
<li><p><code>.text-lowercase</code></p>
</li>
<li><p><code>.text-uppercase</code></p>
</li>
<li><p><code>.text-capitalize</code></p>
</li>
</ul>
<h2 id="表格"><a href="#表格" class="headerlink" title="表格"></a>表格</h2><ul>
<li><p>带边框的表格：<code>.table-bordered</code></p>
</li>
<li><p>条纹状表格：<code>.table-striped</code></p>
</li>
<li><p>悬停变色：<code>table-hover</code></p>
</li>
<li><p>紧凑风格：<code>.table-condensed</code></p>
</li>
</ul>
<h3 id="表格样式"><a href="#表格样式" class="headerlink" title="表格样式"></a>表格样式</h3><table>
<thead>
<tr>
<th>表格</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>.table-primary</code></td>
<td>蓝色: 指定这是一个重要的操作</td>
</tr>
<tr>
<td><code>.table-success</code></td>
<td>绿色: 指定这是一个允许执行的操作</td>
</tr>
<tr>
<td><code>.table-danger</code></td>
<td>红色: 指定这是可以危险的操作</td>
</tr>
<tr>
<td><code>.table-info</code></td>
<td>浅蓝色: 表示内容已变更</td>
</tr>
<tr>
<td><code>.table-warning</code></td>
<td>橘色: 表示需要注意的操作</td>
</tr>
<tr>
<td><code>.table-active</code></td>
<td>灰色: 用于鼠标悬停效果</td>
</tr>
<tr>
<td><code>.table-secondary</code></td>
<td>灰色: 表示内容不怎么重要</td>
</tr>
<tr>
<td><code>.table-light</code></td>
<td>浅灰色，可以是表格行的背景</td>
</tr>
<tr>
<td><code>.table-dark</code></td>
<td>深灰色，可以是表格行的背景</td>
</tr>
</tbody></table>
<h2 id="表单"><a href="#表单" class="headerlink" title="表单"></a>表单</h2><p>bootstrap 给 HTML 大部分表单都设置了默认样式，我们可以给表单添加相应类名，以实现表单的水平排列，个性化定制等</p>
<p>bootstrap 提供了下列类型的表单布局：</p>
<ul>
<li><p>垂直表单（默认）</p>
</li>
<li><p>内联表单</p>
</li>
<li><p>水平表单</p>
</li>
</ul>
<h3 id="基本表单（垂直表单）"><a href="#基本表单（垂直表单）" class="headerlink" title="基本表单（垂直表单）"></a>基本表单（垂直表单）</h3><p>创建基本表单的步骤：</p>
<ol>
<li><p>向父 <code>&lt;form&gt;</code> 元素添加 <code>role=&quot;form&quot;</code>。</p>
</li>
<li><p>把标签和控件放在一个带有 <code>class .form-group</code> 的 <code>&lt;div&gt;</code> 中。这是获取最佳间距所必需的。</p>
</li>
<li><p>向所有的文本元素 <code>&lt;input&gt;</code>、<code>&lt;textarea&gt;</code> 和 <code>&lt;select&gt;</code> 添加 <code>class =&quot;form-control&quot;</code> 。</p>
</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">&lt;form role=&quot;form&quot;&gt;</span><br><span class="line">&lt;div class=&quot;form-group&quot;&gt;</span><br><span class="line">    &lt;label for=&quot;name&quot;&gt;名称&lt;/label&gt;</span><br><span class="line">    &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;name&quot; placeholder=&quot;请输入名称&quot;&gt;</span><br><span class="line">&lt;/div&gt;</span><br><span class="line">&lt;div class=&quot;form-group&quot;&gt;</span><br><span class="line">    &lt;label for=&quot;inputfile&quot;&gt;文件输入&lt;/label&gt;</span><br><span class="line">    &lt;input type=&quot;file&quot; id=&quot;inputfile&quot;&gt;</span><br><span class="line">    &lt;p class=&quot;help-block&quot;&gt;这里是块级帮助文本的实例。&lt;/p&gt;</span><br><span class="line">&lt;/div&gt;</span><br><span class="line">&lt;div class=&quot;checkbox&quot;&gt;</span><br><span class="line">    &lt;label&gt;</span><br><span class="line">    &lt;input type=&quot;checkbox&quot;&gt;请打勾</span><br><span class="line">    &lt;/label&gt;</span><br><span class="line">&lt;/div&gt;</span><br><span class="line">&lt;button type=&quot;submit&quot; class=&quot;btn btn-default&quot;&gt;提交&lt;/button&gt;</span><br><span class="line">&lt;/form&gt;</span><br></pre></td></tr></table></figure>

<h3 id="内联表单"><a href="#内联表单" class="headerlink" title="内联表单"></a>内联表单</h3><p>如果需要创建一个表单，它的所有元素是内联的，向左对齐的，标签是并排的，请向 <code>&lt;form&gt;</code> 标签添加 <code>class .form-inline</code></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">&lt;form class=&quot;form-inline&quot; role=&quot;form&quot;&gt;</span><br><span class="line">    &lt;div class=&quot;form-group&quot;&gt;</span><br><span class="line">        &lt;label class=&quot;sr-only&quot; for=&quot;name&quot;&gt;名称&lt;/label&gt;</span><br><span class="line">        &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;name&quot; placeholder=&quot;请输入名称&quot;&gt;</span><br><span class="line">    &lt;/div&gt;</span><br><span class="line">    &lt;div class=&quot;form-group&quot;&gt;</span><br><span class="line">        &lt;label class=&quot;sr-only&quot; for=&quot;inputfile&quot;&gt;文件输入&lt;/label&gt;</span><br><span class="line">        &lt;input type=&quot;file&quot; id=&quot;inputfile&quot;&gt;</span><br><span class="line">    &lt;/div&gt;</span><br><span class="line">    &lt;div class=&quot;checkbox&quot;&gt;</span><br><span class="line">        &lt;label&gt;</span><br><span class="line">        &lt;input type=&quot;checkbox&quot;&gt;请打勾</span><br><span class="line">        &lt;/label&gt;</span><br><span class="line">    &lt;/div&gt;</span><br><span class="line">    &lt;button type=&quot;submit&quot; class=&quot;btn btn-default&quot;&gt;提交&lt;/button&gt;</span><br><span class="line">&lt;/form&gt;</span><br></pre></td></tr></table></figure>

<h4 id="注意"><a href="#注意" class="headerlink" title="注意"></a>注意</h4><ul>
<li><p>默认情况下，Bootstrap 中的 <code>input``、select</code> 和 <code>textarea</code> 有 100% 宽度。在使用内联表单时，您需要在表单控件上设置一个宽度。</p>
</li>
<li><p>使用 <code>class .sr-only</code>，您可以隐藏内联表单的标签。</p>
</li>
</ul>
<h3 id="水平表单"><a href="#水平表单" class="headerlink" title="水平表单"></a>水平表单</h3><p>水平表单与其他表单不仅标记的数量上不同，而且表单的呈现形式也不同。如需创建一个水平布局的表单，请按下面的几个步骤进行：</p>
<ol>
<li><p>向父 <code>&lt;form&gt;</code> 元素添加 <code>class .form-horizontal</code></p>
</li>
<li><p>把标签和控件放在一个带有 <code>class .form-group</code> 的 <code>&lt;div&gt;</code> 中</p>
</li>
<li><p>向标签添加 <code>class .control-label</code></p>
</li>
</ol>
<p>实例</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line">&lt;form class=&quot;form-horizontal&quot; role=&quot;form&quot;&gt;</span><br><span class="line">    &lt;div class=&quot;form-group&quot;&gt;</span><br><span class="line">        &lt;label for=&quot;firstname&quot; class=&quot;col-sm-2 control-label&quot;&gt;名字&lt;/label&gt;</span><br><span class="line">        &lt;div class=&quot;col-sm-10&quot;&gt;</span><br><span class="line">        &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;firstname&quot; placeholder=&quot;请输入名字&quot;&gt;</span><br><span class="line">        &lt;/div&gt;</span><br><span class="line">    &lt;/div&gt;</span><br><span class="line">    &lt;div class=&quot;form-group&quot;&gt;</span><br><span class="line">        &lt;label for=&quot;lastname&quot; class=&quot;col-sm-2 control-label&quot;&gt;姓&lt;/label&gt;</span><br><span class="line">        &lt;div class=&quot;col-sm-10&quot;&gt;</span><br><span class="line">        &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;lastname&quot; placeholder=&quot;请输入姓&quot;&gt;</span><br><span class="line">        &lt;/div&gt;</span><br><span class="line">    &lt;/div&gt;</span><br><span class="line">    &lt;div class=&quot;form-group&quot;&gt;</span><br><span class="line">        &lt;div class=&quot;col-sm-offset-2 col-sm-10&quot;&gt;</span><br><span class="line">        &lt;div class=&quot;checkbox&quot;&gt;</span><br><span class="line">            &lt;label&gt;</span><br><span class="line">            &lt;input type=&quot;checkbox&quot;&gt;请记住我</span><br><span class="line">            &lt;/label&gt;</span><br><span class="line">        &lt;/div&gt;</span><br><span class="line">        &lt;/div&gt;</span><br><span class="line">    &lt;/div&gt;</span><br><span class="line">    &lt;div class=&quot;form-group&quot;&gt;</span><br><span class="line">        &lt;div class=&quot;col-sm-offset-2 col-sm-10&quot;&gt;</span><br><span class="line">        &lt;button type=&quot;submit&quot; class=&quot;btn btn-default&quot;&gt;登录&lt;/button&gt;</span><br><span class="line">        &lt;/div&gt;</span><br><span class="line">    &lt;/div&gt;</span><br><span class="line">&lt;/form&gt;</span><br></pre></td></tr></table></figure>

<h3 id="输入框"><a href="#输入框" class="headerlink" title="输入框"></a>输入框</h3><p>向 <code>input</code> 输入框添加以下类名可产生相应变化</p>
<table>
<thead>
<tr>
<th>类名</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>.input-lg</code></td>
<td>输入框变大</td>
</tr>
<tr>
<td><code>.input-sm</code></td>
<td>输入框变小</td>
</tr>
</tbody></table>
<h3 id="标签"><a href="#标签" class="headerlink" title="标签"></a>标签</h3><p>向 <code>label</code> 标签添加以下类名可产生相应变化</p>
<table>
<thead>
<tr>
<th>类名</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>.sr-only</code></td>
<td>该标签隐藏</td>
</tr>
<tr>
<td><code>.control-label</code></td>
<td>如果上一级包含<code>.form-group</code>的<code>div</code>标签中有类似于<code>.has-success</code>的类名，改变该标签的状态</td>
</tr>
</tbody></table>
<h3 id="按钮"><a href="#按钮" class="headerlink" title="按钮"></a>按钮</h3><p>向 <code>button</code> 标签添加以下类名可产生相应变化</p>
<p>并不局限于 <code>button</code> 标签，比如也可以在 <code>a</code> 标签中设置</p>
<table>
<thead>
<tr>
<th>类名</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>.btn</code></td>
<td>按钮变为圆角</td>
</tr>
<tr>
<td><code>.btn-default</code></td>
<td>鼠标移入、访问会有不同效果</td>
</tr>
<tr>
<td><code>.btn-success</code></td>
<td>改变颜色。绿色</td>
</tr>
<tr>
<td><code>.btn-lg</code></td>
<td>按钮变大</td>
</tr>
<tr>
<td><code>.btn-sm</code></td>
<td>按钮变小</td>
</tr>
<tr>
<td><code>.btn-block</code></td>
<td>按钮长度和屏幕一样长</td>
</tr>
</tbody></table>
<h2 id="图片"><a href="#图片" class="headerlink" title="图片"></a>图片</h2><table>
<thead>
<tr>
<th>类名</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>.img-rounded</code></td>
<td>圆角</td>
</tr>
<tr>
<td><code>.img-circle</code></td>
<td>圆形</td>
</tr>
<tr>
<td><code>.img-thumbnail</code></td>
<td>带有边框的圆角图形</td>
</tr>
<tr>
<td><code>.img-responsive</code></td>
<td>图片响应式 (将很好地扩展到父元素)</td>
</tr>
</tbody></table>
<h2 id="辅助类"><a href="#辅助类" class="headerlink" title="辅助类"></a>辅助类</h2><p><a href="https://www.runoob.com/bootstrap/bootstrap-helper-classes.html" target="_blank" rel="noopener">请转至此链接查看</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/10/07/bootstrap入门之全局样式/" data-id="ck4r400st00aal0w0z2ug2ct5" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/bootstrap/">bootstrap</a></li></ul>

    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    
    <a class="extend prev" rel="prev" href="/page/2/">&laquo; Prev</a><a class="page-number" href="/">1</a><a class="page-number" href="/page/2/">2</a><span class="page-number current">3</span><a class="page-number" href="/page/4/">4</a><a class="page-number" href="/page/5/">5</a><span class="space">&hellip;</span><a class="page-number" href="/page/12/">12</a><a class="extend next" rel="next" href="/page/4/">Next &raquo;</a>
  </nav>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Categories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Ajax/">Ajax</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/CSS/">CSS</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/CSS3/">CSS3</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Dart/">Dart</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Flutter/">Flutter</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Git/">Git</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/HTML/">HTML</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/HTML5/">HTML5</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/JSON/">JSON</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Java/">Java</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/JavaScript/">JavaScript</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/QT/">QT</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/React/">React</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Sass/">Sass</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/TheKnowledgeOf/">TheKnowledgeOf</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/TypeScript/">TypeScript</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/bootstrap/">bootstrap</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/jQuery/">jQuery</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Ajax/">Ajax</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CSS/">CSS</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CSS3/">CSS3</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Dart/">Dart</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Flutter/">Flutter</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Git/">Git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/HTML/">HTML</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/HTML5/">HTML5</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JSON/">JSON</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Java/">Java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JavaScript/">JavaScript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Javascript/">Javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/QT/">QT</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/React/">React</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Sass/">Sass</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/TheKnowledgeOf/">TheKnowledgeOf</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/TypeScript/">TypeScript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/bootstrap/">bootstrap</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/jQuery/">jQuery</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/Ajax/" style="font-size: 12.22px;">Ajax</a> <a href="/tags/CSS/" style="font-size: 18.89px;">CSS</a> <a href="/tags/CSS3/" style="font-size: 17.78px;">CSS3</a> <a href="/tags/Dart/" style="font-size: 14.44px;">Dart</a> <a href="/tags/Flutter/" style="font-size: 16.67px;">Flutter</a> <a href="/tags/Git/" style="font-size: 12.22px;">Git</a> <a href="/tags/HTML/" style="font-size: 14.44px;">HTML</a> <a href="/tags/HTML5/" style="font-size: 12.22px;">HTML5</a> <a href="/tags/JSON/" style="font-size: 10px;">JSON</a> <a href="/tags/Java/" style="font-size: 11.11px;">Java</a> <a href="/tags/JavaScript/" style="font-size: 20px;">JavaScript</a> <a href="/tags/Javascript/" style="font-size: 10px;">Javascript</a> <a href="/tags/QT/" style="font-size: 12.22px;">QT</a> <a href="/tags/React/" style="font-size: 15.56px;">React</a> <a href="/tags/Sass/" style="font-size: 11.11px;">Sass</a> <a href="/tags/TheKnowledgeOf/" style="font-size: 11.11px;">TheKnowledgeOf</a> <a href="/tags/TypeScript/" style="font-size: 10px;">TypeScript</a> <a href="/tags/bootstrap/" style="font-size: 11.11px;">bootstrap</a> <a href="/tags/jQuery/" style="font-size: 13.33px;">jQuery</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/12/">December 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/11/">November 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/10/">October 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/09/">September 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/08/">August 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/07/">July 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/06/">June 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/05/">May 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/04/">April 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/03/">March 2019</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2019/12/29/Flutter-MaterialApp常用属性介绍/">Flutter-MaterialApp常用属性介绍</a>
          </li>
        
          <li>
            <a href="/2019/12/29/Flutter-ListView/">Flutter-ListView</a>
          </li>
        
          <li>
            <a href="/2019/12/29/Flutter-AppBar/">Flutter-AppBar</a>
          </li>
        
          <li>
            <a href="/2019/12/29/Flutter-TabBar/">Flutter-TabBar</a>
          </li>
        
          <li>
            <a href="/2019/12/29/Flutter-按钮/">Flutter-按钮</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2019 John Doe<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>



  </div>
</body>
</html>